package com.richinfo.trace1.controller;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
* Created by WangXJ
* 2018-11-30 14:52
*/
@RestController
public class TraceController {
	
	private static Logger logger = LoggerFactory.getLogger(TraceController.class);
	
	@Resource
	RestTemplate restTemplate;//不要用修饰符修饰！
	
	@GetMapping(value = "/trace-1")
	public String trace() {
		logger.info("====== call trace-1 ======");
		
		return restTemplate.getForEntity("http://trace-2/trace-2", String.class).getBody();
	}
}
